import {
  defineComponent,
  ref,
  resolveDirective,
  withDirectives,
  openBlock,
  createElementBlock,
  unref
} from "vue";
import { j as useData } from "./index-CEDaTd93.js";
import { u as useEchart } from "./hooks-aBG276Pf.js";
const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "ComChart",
  props: {
    component: {}
  },
  setup(__props) {
    const props = __props;
    const chartEl = ref(null);
    const { updateEchart, resizeHandler } = useEchart(chartEl);
    const dataChange = (resp, _) => {
      if (!resp || !resp.afterData) {
        return;
      }
      if (resp.status === "SUCCESS") {
        updateEchart(resp.afterData);
      }
    };
    useData(props.component, dataChange);
    return (_ctx, _cache) => {
      const _directive_resize = resolveDirective("resize");
      return withDirectives(
        (openBlock(),
        createElementBlock(
          "div",
          {
            ref_key: "chartEl",
            ref: chartEl
          },
          null,
          512
        )),
        [[_directive_resize, unref(resizeHandler)]]
      );
    };
  }
});
export { _sfc_main as default };
